import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

public class Test {
    public static void SelectSort(int[] array){
        int minIndex=0;
        int tmp=0;
        for (int i = 0; i < array.length-1; i++) {
            minIndex=i;
            for (int j = i+1; j < array.length ; j++) {
                if(array[j]< array[minIndex]){
                    minIndex=j;
                }
            }
            tmp=array[i];
            array[i]= array[minIndex];
            array[minIndex]=tmp;
        }
    }
    public static void bubbleSort(int[] array){
        int count=0;
        for(int i=0;i<array.length-1;i++){//控制比较轮次，一共 n-1 趟
            for(int j=0;j<array.length-1-i;j++){//控制两个挨着的元素进行比较
                if(array[j] > array[j+1]){
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                }
            }
       }
    }


    public static void main1(String[] args) {
        int[] array={23,2,45,78,11};
        bubbleSort(array);
        System.out.println(Arrays.toString(array));
    }

    public static void main(String[] args) {
        TreeMap<String,Integer> map = new TreeMap<>();
        map.put("hello",2);
        map.put("abc",4);
        map.put("abc",14);
        Set<Map.Entry<String,Integer>> entrySet = map.entrySet();
        for (Map.Entry<String,Integer> entry  : entrySet) {
            System.out.println("key: "+entry.getKey() +" val: "+entry.getValue());
        }

    }
}
